<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}


$page = !($_POST['pageNum'])?'1':intval($_POST['pageNum']);
$pagesize= !($_POST['numPerPage'])?'20':intval($_POST['numPerPage']);


if(empty($pagesize)){
    $pagesize=20;
}
$frmnum=($page-1)*$pagesize;
$orderField=trim($_POST["orderField"]);
$orderDirection=trim($_POST["orderDirection"]);
if(empty($orderField)){
    $orderField="id";
}
if(empty($orderDirection)){
    $orderDirection="desc";
}
if($orderField<>""){
    $order=" order by $orderField ".$orderDirection;
}else{
    $order=" order by id desc";
}

$q=trim($_POST['q']);
$total=$ezhand->count(MOD,"`adminname` like '%$q%'");
$row=$ezhand->select_all(MOD,'*','`adminname` like "%'.$q.'%" '.$order.' limit '.$frmnum.','.$pagesize);

?>